
//公司团队部分鼠标移入效果
var dls = document.querySelectorAll(".team>main>.content>dl")

dls.forEach(dl => {
    dl.onmouseover = function () {
        dls.forEach(dl => {
            dl.firstElementChild.nextElementSibling.nextElementSibling.style.display = "none"
        })
        this.firstElementChild.nextElementSibling.nextElementSibling.style.display = "block"

    }
});
//公司团队部分鼠标点击效果
dls.forEach(dl => {
    dl.onclick = function () {
        // window.location.href = "team.html ";
        open("team.html","_blank")
    }
});

//轮播图
var banner = document.getElementsByClassName("banner")[0];
var btns = document.querySelectorAll("button");
var lis = document.querySelectorAll("li");
var imgs = document.querySelectorAll(".banner>.picture>img");

j = 0;
btns.forEach(btn => {
    btn.onclick = function () {

        if (this.innerText == ">") {
            j++;
            j == lis.length && (j = 0);

            for (var i = 0; i < lis.length; i++) {
                lis[i].className = ""
                imgs[i].className = ""
            }

            lis[j].className = "active";
            imgs[j].className = "active"
            // console.log(imgs[j])
        } else if (this.innerText == "<") {
            j--;
            j == -1 && (j = lis.length - 1);
            for (var i = 0; i < lis.length; i++) {
                lis[i].className = "";
                imgs[i].className = "";
            }
            imgs[j].className = "active";
            lis[j].className = "active"
        }



    }
});
for (let j = 0; j < lis.length; j++){
    lis[j].onclick = function () {
        for (var i = 0; i < lis.length; i++){
            lis[i].className = "";
            imgs[i].className = "";
        }
        this.className = "active";
        imgs[j].className = "active";
    }
}
timer = setInterval(function () {
    j++;
    j == lis.length && (j = 0);

    for (var i = 0; i < lis.length; i++) {
        lis[i].className = ""
        imgs[i].className = ""
    }

    lis[j].className = "active";
    imgs[j].className = "active"
}, 1500)
banner.onmouseover = function () {
    clearInterval(timer)
}
banner.onmouseout = function () {
    clearInterval(timer)
    timer = setInterval(function () {
        j++;
        j == lis.length && (j = 0);
    
        for (var i = 0; i < lis.length; i++) {
            lis[i].className = ""
            imgs[i].className = ""
        }
    
        lis[j].className = "active";
        imgs[j].className = "active"
    }, 1500)
}

//产品介绍点击事件
var coffee = document.querySelectorAll(".product>main>.details>.coffee");
console.log(coffee)
var dets = document.querySelector(".details");

dets.onclick = e => {
    e = window.event;
    var target = e.srcElement;
    target.className="active"
   
    open("product.html","_blank")
}




